// pages/annocement/studentANNCPage.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    msgHidden: true,
    alert_hidden: true,
    ab: "absolute",
    heightMsg: "",
    fixed: "",
    id: undefined,
    msgtitle: undefined,
    msgcontent: undefined,
    msgtime: undefined,
    msgpublisher: undefined,
    ANNCArray: [
      {
        id: 0,
        title: undefined,
        content: undefined,
        publicTime: undefined,
        publisher: undefined,
      },
    ],
  },
 
  alertClick: function () {
    this.setData({
      alert_hidden: false,
      fixed: "fixed",
    })
  },
  escClick: function () {
    this.setData({
      alert_hidden: true,
      msgHidden: true
    })
  },
  msgClick: function (e) {
    var that = this;
      that.setData({
        msgHidden: false,
        msgtitle: e.currentTarget.dataset.title,
        msgcontent: e.currentTarget.dataset.content,
        msgtime: e.currentTarget.dataset.time,
        msgpublisher: e.currentTarget.dataset.publisher,
      })
    
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function () {
    var that = this;
    wx.request({
      url: 'https://weixin0304.cn/getANNCdata.php',
      method: 'GET',
      header: {
        'Content-Type': 'application/json'
      },
      data: {},
      success: function (res) {
        // success
        console.log(res.data);//打印请求返回的结果
        that.setData({ ANNCArray: res.data })
      },
      fail: function (res) {
        // fail
      },
      complete: function (res) {
        // complete
      }
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },
  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },

})
